package cn.itcast.bos.dao.system;

import cn.itcast.bos.domain.system.Role;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

public interface RoleRepositor extends JpaRepository<Role,Integer> {
    @Query(value = "SELECT r.* FROM t_user u,t_user_role ur,t_role r WHERE u.C_ID = ur.C_USER_ID AND R.C_ID = ur.C_ROLE_ID AND u.C_ID = ?"
            ,nativeQuery = true)
    List<Role> findRoleByUser(int id);

}
